package com.chinatechstar.component.commons.utils;


import java.text.ParseException;

public class SecurityUtil {

    public static String getEncryptedPwd(String password) throws Exception {
        return MD5Util.getEncryptedPwd(password);
    }

    public static boolean validPassword(String password, String encpassword) {
        try {
            return MD5Util.validPassword(password, encpassword);
        } catch (Exception e) {
            throw new RuntimeException();
        }
    }

    public static String decode(String inStr) throws Exception {
        return MD5Util.convertMD5(inStr);
    }

    public static String decrypt(String inStr) throws Exception {
        return MD5Util.convertMD5(inStr);
    }

    public static void main(String[] args) throws ParseException {
        String phone = "13485695175";
        // 加密
        String decode = null;
        try {
            decode = decode(phone);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        // 解密
        String decrypt = null;
        try {
            decrypt = decrypt(decode);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }

        System.out.println(phone);
        System.out.println(decode);
        System.out.println(decrypt);

    }
}
